import React from 'react'
import { Modal, message } from 'antd';
import { ExclamationCircleOutlined } from '@ant-design/icons';

const { confirm } = Modal;
/**
 * @description confirm确认提示框
 * @param {object} props
 */
export const showDeleteConfirm = (props) => {
    confirm({
        title: props.title,
        icon: <ExclamationCircleOutlined />,
        content: props.content,
        style: { marginTop: '20vh' },
        width: props.width,
        okText: props.okText || '确定',
        okType: 'danger',
        cancelText: '取消',
        destroyOnClose: true,
        onOk() {
            props.onOk()
        },
        onCancel() {
            if (!props.onCancel) {
                return;
            }
            props.onCancel()
        },
    });
}
/**
 * @description 提示信息
 * @param {object} props
 */
export const showMessage = (props) => {
    message[props.type]({
        content: props.content,
        style: { marginTop: '45vh' },
        duration: props.duration || 1,
        onClose() {
            if (!props.handlerClose) {
                return;
            }
            props.handlerClose()
        }
    })
}
